
/*******************************************************************************
 * client.hpp - client interface for tranzmq
 *
 * Copyright (C) 2006 Nathaniel McCallum <nathaniel@natemccallum.com>
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA
 ******************************************************************************/

#ifndef __BOQUE_TRANZMQ_CLIENT_HPP_2010__
#define __BOQUE_TRANZMQ_CLIENT_HPP_2010__

#include <sys/types.h>

#include <stdexcept>
#include <string>
#include <map>

#include <boost/thread/mutex.hpp>


namespace boque {
namespace tranzmq {


class Client
{

public:
    Client( const std::string& buf_dir );
    ~Client();

public	:
	int	send( const std::string& to, const std::string& data );
	int	send( const std::string& to, const void* data, const u_int32_t size );
    
private :
    Client( const Client& );
    Client&    operator=( const Client& );

private	:

	typedef	void*	channel_v_ptr;
	typedef	std::map< std::string, channel_v_ptr >	channels_type;
	typedef	channels_type::iterator		channels_iterator_type;

private	:
	channel_v_ptr	getChannel( const std::string& addr );

private :
	std::string		_buf_dir;

	channels_type	_channels;

	void*	_zmq_context_p;

};	// class Client


}	// namespace tranzmq
}	// namespace boque


#endif /* __BOQUE_TRANZMQ_CLIENT_HPP_2010__*/

